package reflect;

import java.lang.reflect.Field;

public class ReflectDemo10 {
    public static void main(String[] args) throws Exception {
        String s1="123abc";
        String s2="123abc";
        System.out.println("s1="+s1);
        System.out.println("s2="+s2);
        Class cls=String.class;
        Field fi=cls.getDeclaredField("value");
        fi.setAccessible(true);
        char[] va=(char[])fi.get(s1);
        System.out.println(va);
        va=new char[]{'h','e','l','l','o'};
        fi.set(s1,va);
        System.out.println("s1="+s1);
        System.out.println("s2="+s2);
    }
}
